#include <iostream>

#include "fib.h"
#include "list.h"
#include "queue.h"
#include "stack.h"
#include "vector.h"
using namespace std;

void vector_test() {
    Vector<int> v0(1024);
    for (int i = 0; i < 1024; ++i) {
        v0.insert(i);
    }
    for (int i = 0; i < 1024; ++i) {
        if (v0[i] != i) {
            cout << "error:" << __LINE__ << endl;
            break;
        }
    }
    if (v0.size() != 1024)
        cout << "error:" << __LINE__ << endl;

    v0.unsort();
    cout << "after unsort,v0.disordered():" << v0.disordered() << endl;
    v0.unsort();
    cout << "after unsort,v0.disordered():" << v0.disordered() << endl;

    v0.sort(BUBBLE_SORT);
    if (v0.disordered() != 0) {
        cout << "error:" << __LINE__ << endl;
        for (int i = 0; i < 1024; ++i) {
            cout << v0[i] << endl;
        }
    }

    Rank result = v0.search(1000);
    if (result != 1000)
        cout << "error:" << __LINE__ << endl;

    v0.uniquify();
    if (v0.size() != 1024) {
        cout << "error:" << __LINE__ << endl;
        cout << v0.size() << endl;
    }

    v0[8] = 7;
    v0[9] = 7;
    v0[10] = 7;
    v0.uniquify();
    if (v0.size() != 1021) {
        cout << "error:" << __LINE__ << endl;
        cout << v0.size() << endl;
    }

    v0.remove(0, 1020);
    if (v0.size() != 1)
        cout << "error:" << __LINE__ << endl;

    short arr1[512] = {187};
    for (int i = 0; i < 512; ++i)
        arr1[i] = 187;
    Vector<short> v1(arr1, 256, 512);
    for (int i = 0; i < 256; ++i) {
        if (v1[i] != 187) {
            cout << "error:" << __LINE__ << endl;
            break;
        }
    }

    Vector<short>* v2 = new Vector<short>();
    *v2 = v1;
    v2->deduplicate();
    if (v2->size() != 1)
        cout << "error:" << __LINE__ << endl;

    delete (v2);
    return;
}

void list_test() {
    return;
}

void stack_test() {
    Stack<int> s0;

    return;
}

void queue_test() {
    return;
}